/*!
    \class BoxDashboard BoxDashboard.h
    \brief The BoxDashboard class provides a minimal Dashboard to use in Business in a Box

    Business in a Box BoxDashboard Full Description.

    Example usage:
    \code
    BoxDashboard* BoxDashboardObj = new BoxDashboard(this);
    \endcode

    \note Business in a Box is still considered Beta.

 */

#include "BoxDashboard.h"
#include "ui_BoxDashboard.h"

BoxDashboard::BoxDashboard(QWidget *parent) :
    QDialog(parent),
    m_ui(new Ui::BoxDashboard)
{
    m_ui->setupUi(this);
    this->setObjectName("BoxDashboard");

    this->setAttribute(Qt::WA_TranslucentBackground);
    this->setWindowOpacity(.85);

    this->setWindowFlags(Qt::FramelessWindowHint);
    this->setAttribute(Qt::WA_MacAlwaysShowToolWindow);
    this->setAutoFillBackground(false);

    QDesktopWidget DesktopMonitors;
    qDebug() << DesktopMonitors.screenCount() << endl;

    QRect ScreenRect;
    ScreenRect = QApplication::desktop()->screenGeometry();

    int PrimaryScreenWidth  =   ScreenRect.width();

    if( DesktopMonitors.screenCount() > 1 )
    {

        int ScreenWidth     =   0;
        int ScreenHeight    =   0;
        int i               =   0;

        for( i = 0; i < DesktopMonitors.screenCount(); i++ )
        {
            qDebug() << DesktopMonitors.screen(i)->width();
            ScreenWidth =   ScreenWidth + DesktopMonitors.screen(i)->width();

            if( DesktopMonitors.screen(i)->height() > ScreenHeight  )
            {
                ScreenRect.setHeight( DesktopMonitors.screen(i)->height() );

            }//if( DesktopMonitors.screen(i)->height() > ScreenHeight  )


        }//for( i = 0; i < DesktopMonitors.screenCount(); i++ )

        ScreenRect.setWidth(ScreenWidth);

    }//if( DesktopMonitors.screenCount() > 1 )

    this->setGeometry(ScreenRect);
    m_ui->label->setText(" ");
    m_ui->label->setGeometry(ScreenRect);
    m_ui->labelEsc->setGeometry(m_ui->labelEsc->x(), m_ui->labelEsc->y(), PrimaryScreenWidth, ScreenRect.height());

}//BoxDashboard::BoxDashboard(QWidget *parent) :

BoxDashboard::~BoxDashboard()
{
    delete m_ui;

}//BoxDashboard::~BoxDashboard()

void BoxDashboard::changeEvent(QEvent *e)
{
    switch (e->type())
    {
    case QEvent::LanguageChange:
        m_ui->retranslateUi(this);
        break;
    default:
        break;
    }//switch (e->type())

}//void BoxDashboard::changeEvent(QEvent *e)
